﻿// This code is released under the BSD license.
namespace PugLib.UnitTest
{
    using Cryptography;
    using Microsoft.VisualStudio.TestTools.UnitTesting;

    [TestClass]
    public class SaltedHashTest
    {
        [TestMethod]
        public void CreateWithSaltTest()
        {
            const string salt = "icanhas";
            const string password = "sekrit";


            SaltedHash actual = SaltedHash.CreateWithSalt(salt, password);
            Assert.IsTrue(SaltedHash.Verify(salt, password, actual.Hash));

            actual = SaltedHash.Create(password);
            Assert.IsTrue(actual.Verify(password));

            SaltedHash expected = SaltedHash.Create(salt, SaltedHash.CreateWithSalt(salt, password).Hash);
            Assert.IsTrue(expected.Verify(password));
        }
    }
}